package com.wanmait.deliverymangementsystem.managecontroller;

import com.github.pagehelper.PageInfo;
import com.wanmait.deliverymangementsystem.pojo.Orders;
import com.wanmait.deliverymangementsystem.service.OrdersService;
import com.wanmait.deliverymangementsystem.service.RunnerService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

@Controller
@RequestMapping("manage")
public class MangeOrdersController {
@Resource
private OrdersService ordersService;
@Resource
private RunnerService runnerService;
    @GetMapping("orderList")
    @ModelAttribute("ordersPageInfo")
    public PageInfo<Orders> orderList(Integer page){
        PageInfo<Orders> ordersPageInfo =ordersService.adminFindAll(page);
        return ordersPageInfo;
    }
    @GetMapping("deleteOrder")
    public String deleteOrder(Integer id){
        ordersService.deleteAdmin(id);
        return  "redirect:/manage/orderList";
    }

}
